import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)


// 路由
export const constantRoutes = [
  {
    path: '/',
    component: () => import('@/views/enterprise/index'),
    hidden: true,
  },
  {
    path: '/details',
    component: () => import('@/views/enterprise/details'),
    hidden: true
  },
  {
    path: '/purchase',
    component: () => import('@/views/enterprise/purchase'),
    hidden: true
  },
  {
    path: '/filedcase',
    component: () => import('@/views/enterprise/filedcase'),
    hidden: true
  },
  {
    path: '/punish',
    component: () => import('@/views/enterprise/punish'),
    hidden: true
  },
  {
	  path: '/taxpunish',
	  component: () => import('@/views/enterprise/taxpunish'),
	  hidden: true
  },
  {
  	  path: '/shixin',
  	  component: () => import('@/views/enterprise/shixin'),
  	  hidden: true
  },
  {
  	  path: '/notice',
  	  component: () => import('@/views/enterprise/notice'),
  	  hidden: true
  },
  {
  	  path: '/lawsuit',
  	  component: () => import('@/views/enterprise/lawsuit'),
  	  hidden: true
  },
  {
  	  path: '/announcement',
  	  component: () => import('@/views/enterprise/announcement'),
  	  hidden: true
  },
  {
  	  path: '/zhixing',
  	  component: () => import('@/views/enterprise/zhixing'),
  	  hidden: true
  },
  {
  	  path: '/employment',
  	  component: () => import('@/views/enterprise/employment'),
  	  hidden: true
  },
  {
  	  path: '/bid',
  	  component: () => import('@/views/enterprise/bid'),
  	  hidden: true
  },
  {
  	  path: '/chattel',
  	  component: () => import('@/views/enterprise/chattel'),
  	  hidden: true
  },
  {
  	  path: '/pledge',
  	  component: () => import('@/views/enterprise/pledge'),
  	  hidden: true
  },
  {
  	  path: '/trademark',
  	  component: () => import('@/views/enterprise/trademark'),
  	  hidden: true
  },
  {
  	  path: '/patentinfo',
  	  component: () => import('@/views/enterprise/patentinfo'),
  	  hidden: true
  },
  {
  	  path: '/software',
  	  component: () => import('@/views/enterprise/software'),
  	  hidden: true
  },
  {
  	  path: '/works',
  	  component: () => import('@/views/enterprise/works'),
  	  hidden: true
  },
  {
    path: '/query',
    component: () => import('@/views/enterprise/query'),
    hidden: true
  },
  {
    path: '/filter',
    component: () => import('@/views/enterprise/filter'),
    hidden: true
  },
  {
    path: '/allow',
    component: () => import('@/views/enterprise/allow'),
    hidden: true
  },
  {
    path: '/earlywarning',
    component: () => import('@/views/warning/earlywarning'),
    hidden: true
  },
  {
    path: '/favorite',
    component: () => import('@/views/warning/favorite'),
    hidden: true
  },
  {
    path: '/addenterprise',
    component: () => import('@/views/warning/addenterprise'),
    hidden: true
  },
  {
    path: '/Companydynamics',
    component: () => import('@/views/warning/Companydynamics'),
    hidden: true
  },
  {
    path: '/mapindex',
    component: () => import('@/views/busNeighbors/mapindex'),
    hidden: true
  },
  {
    path: '/404',
    component: () => import('@/views/error/404'),
    hidden: true
  },
  {
    path: '/401',
    component: () => import('@/views/error/401'),
    hidden: true
  },
  {
    path: '/bus-neighbors',
    component: () => import('@/views/busNeighbors'),
    hidden: true,
    redirect: '/bus-neighbors/detail',
    meta: {
      title: '企业邻居'
    },
    children: [{
      path: '/bus-neighbors/list',
      component: () => import('@/views/busNeighbors/list'),
      hidden: true,
      meta: {
        title: '企业列表',
        banner: true
      }
    }, {
      path: '/bus-neighbors/publish',
      component: () => import('@/views/busNeighbors/publish'),
      hidden: true,
      meta: {
        title: '发布招聘岗位',
        banner: true
      }
    }, {
      path: '/bus-neighbors/intellectual',
      component: () => import('@/views/busNeighbors/intellectual'),
      hidden: true,
      meta: {
        title: '知识产权',
        banner: true
      }
    }, {
      path: '/bus-neighbors/detail',
      component: () => import('@/views/busNeighbors/detail'),
      hidden: true,
      meta: {
        title: '详情',
        banner: false
      }
    }]
  }
]


// 防止连续点击多次路由报错
let routerPush = Router.prototype.push;
let routerReplace = Router.prototype.replace;
// push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(err => err)
}
// replace
Router.prototype.replace = function push(location) {
  return routerReplace.call(this, location).catch(err => err)
}

export default new Router({
  mode: 'history', // 去掉url中的#
  base:'/pqt-pc',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})
